package priv.yangguolong.Chapter03;
import java.util.*;
/**
 * 	This program demonstrates a <code>for</code>loop
 * @version 1.20 2020-01-17
 * @author yang_guo_long
 *
 */
public class Lottery0dds {
public static void main(String[] args) {
	Scanner in = new Scanner(System.in);
	System.out.print("How many numbers do you need to draw?");
	int k = in.nextInt();
	System.out.print("What is the highest numbers you can draw?");
	int n = in.nextInt();
	/*
	 * compute binomial coefficient n*(n-1)*(n-2)...(n-k+1)/(1*2*3*4*5*k)
	 */
	int lotteryodds = 1;
	for(int i =1;i <= k;i++)
		lotteryodds = lotteryodds*(n-i+1)/i;
	System.out.println("Your odds are 1 in "+lotteryodds+".Good luck!");
}
}
